package z_app_lotto;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.util.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Lotto2 extends JFrame {
    BorderLayout borderLayout1 = new BorderLayout();
    JMenuBar jMenuBar1 = new JMenuBar();
    JMenu jMenu1 = new JMenu();
    JMenuItem jMenuItem1 = new JMenuItem();
    JMenuItem jMenuItem2 = new JMenuItem();
    JMenuItem jMenuItem3 = new JMenuItem();
    JMenuItem jMenuItem4 = new JMenuItem();
    JMenu jMenu2 = new JMenu();
    JMenuItem jMenuItem5 = new JMenuItem();

    Vector v = new Vector(100,10); // lotto data

    JMenuItem jMenuItem6 = new JMenuItem();
    public Lotto2() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(borderLayout1);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setJMenuBar(jMenuBar1);
        jMenu1.setText("Data");
        jMenuItem1.setText("Load");
        jMenuItem2.setText("Input");
        jMenuItem3.setText("List");
        jMenuItem4.setText("Delete");
        jMenu2.setText("Simulation");
        jMenuItem5.setText("Type1");
        jMenuItem5.addActionListener(new Lotto2_jMenuItem5_actionAdapter(this));
        jMenuItem6.setText("Type2");
        jMenuItem6.addActionListener(new Lotto2_jMenuItem6_actionAdapter(this));
        jMenuBar1.add(jMenu1);
        jMenuBar1.add(jMenu2);
        jMenu1.add(jMenuItem1);
        jMenu1.add(jMenuItem2);
        jMenu1.add(jMenuItem3);
        jMenu1.add(jMenuItem4);
        jMenu2.add(jMenuItem5);
        jMenu2.add(jMenuItem6);

        LoadData l = new LoadData();
        v = l.getData();

    }

    public static void main(String[] args) {
        Lotto2 lotto2 = new Lotto2();
        lotto2.setSize(800,600);
        lotto2.setVisible(true);
    }

    // type1
    public void jMenuItem5_actionPerformed(ActionEvent e) {
        Sim1 s = new Sim1(v);
        this.getContentPane().removeAll();
        this.getContentPane().add(s);
        s.updateUI();
    }
    // type2
    public void jMenuItem6_actionPerformed(ActionEvent e) {
        Sim2 s = new Sim2(v);
        this.getContentPane().removeAll();
        this.getContentPane().add(s);
        s.updateUI();

    }
}


class Lotto2_jMenuItem6_actionAdapter implements ActionListener {
    private Lotto2 adaptee;
    Lotto2_jMenuItem6_actionAdapter(Lotto2 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jMenuItem6_actionPerformed(e);
    }
}


class Lotto2_jMenuItem5_actionAdapter implements ActionListener {
    private Lotto2 adaptee;
    Lotto2_jMenuItem5_actionAdapter(Lotto2 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jMenuItem5_actionPerformed(e);
    }
}
